("Set the scanner compression mode:", "-x<mode> or --compression=<mode>, <mode>='raw', 'none' or 'jpeg' ('jpeg' is default) ('raw' and 'none' are equivalent)", "option", False),],
see_also_list=[])
opts, device_uri, printer_name, mode, ui_toolkit, lang = \
log.error("A problem has occurred with PDF generation. This is a known bug in ReportLab. Please update your install of ReportLab to version 2.0 or greater.")
sys.exit(1)
c.showPage()
log.info("Saving to file %s" % output)
c.save()
log.info("Viewing PDF file in %s" % pdf_viewer)
os.system("%s %s &" % (pdf_viewer, output))
sys.exit(0)
if resize != 100:
if resize < 1 or resize > 400:
log.error("Resize parameter is incorrect. Resize must be 0% < resize < 400%.")
log.error("Using resize value of 100%.")
else:
new_w = pixels_per_line * resize / 100
new_h = lines * resize / 100
log.info("Resizing from %dx%d to %dx%d..." % (pixels_per_line, lines, new_w, new_h))
im = im.resize((new_w, new_h), Image.ANTIALIAS)
file_saved = False
if 'file' in dest:
log.info("\nOutputting to destination 'file':")
log.info("Saving to file %s" % output)
try:
im.save(output)
except IOError, e:
log.error("Error saving file: %s (I/O)" % e)
try:
os.remove(output)
except OSError:
pass
sys.exit(1)
except ValueError, e:
log.error("Error saving file: %s (PIL)" % e)
try:
os.remove(output)
except OSError:
pass
sys.exit(1)
file_saved = True
dest.remove("file")
temp_saved = False
if ('editor' in dest or 'viewer' in dest or 'email' in dest or 'printer' in dest) \
log.error("A problem has occurred with PDF generation. This is a known bug in ReportLab. Please update your install of ReportLab to version 2.0 or greater.")